<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title></title>
    <link rel="stylesheet" href="css/layer.css" />
    <link rel="stylesheet" href="css/style.css" />
	<link rel="icon" href="images/favicon.png">
</head>
<body>
	<header class="mui-bar mui-bar-nav">
		<a class="back_a">
			<img src="images/back.png"/>
		</a>
		<span class="mui-title">申请升级</sapn>
		<a onclick="business()" class="back_sj">商家信息</a>
	</header>
	<div class="install_bg">
		<p class="apply_op">您当前的等级：<span class="apply_vip"></span></p>
		<p class="apply_op">您可申请升级的等级：<span class="apply_two"></span></p>
		<p class="apply_op">是否提交申请？</p>
	</div>
	<div class="install_btn tj"><button id="tjsq" >提交申请</button></div>
</body>
<script type="text/javascript" src="js/jquery.js" ></script>
<script type="text/javascript" src="js/layer.js" ></script>
<script type="text/javascript">
    //返回上一级
    $(".back_a").click(function(){
        window.location.href ="/index";
    })
    //商家信息
    function business(){
        window.location.href ="/business";
    }
    //获取用户信息
    var storage=window.localStorage;
    var token=storage.token;
    if(token==undefined){
        window.location.href = "/"
    }
    $('.apply_vip').html(storage.idName);
    $('.apply_two').html(storage.nextName);
    $('#tjsq').click(function () {
    	$('#tjsq').attr('disabled','disabled');
		$.ajax({
			type: "POST",
			url: "/users/identity/vip?token="+token,
			contentType: "application/json;charset=UTF-8",
			data:"",
			dataType: "json",
			success: function (data) {
				if (data.code && data.code==='success') {
                    layer.msg(data.message);
                    setTimeout(function() { window.location.href = "/business"; }, 2000 );
                } else {
                    layer.msg(data.message+"，请重试",{icon:2,time:3000});
					setTimeout(function() { $('#tjsq').attr('disabled',false); }, 5000 );
                }
			},
			error: function (data) {
                if(data.code==undefined){
                    layer.msg("登录失效",{icon:2,time:1000});
                    window.location.href ="/";
                }
				layer.msg(data.message,{icon:2,time:1000});
			}
		});
	});

</script>
<style>
	#tjsq{
		border: 0;
		background: none;
		color: #fff;
		font-size: 16px;
		letter-spacing: 2px;
	}
</style>

</html>